export default {
  async login(credentials) {
    return new Promise((resolve, reject) => {
      const validUsername = 'admin';
      const validPassword = '123456';
  
      if (
        credentials.username === validUsername &&
        credentials.password === validPassword
      ) {
        setTimeout(() => {
          resolve({
            data: {
              token: 'fake-token',
              user: { username: 'Admin' },
            },
          });
        }, 1000);
      } else {
        reject(new Error('用户名或密码错误'));
      }
    });
  },
  uploadImage: formData => api.post('/recognition/upload', formData),
  getAnalysis: params => api.get('/analysis', { params }),
  getKnowledge: () => api.get('/knowledge'),
};
